package com.cn.qtms.dao;//类注释设置模板

import com.cn.qtms.base.dao.BaseDao;
import com.cn.qtms.entity.TmGoodsPrice;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;

/**
 * @Name:TmGoodsDao
 * @Description:
 * @Author: zhangyang
 * @Date 2019-12-25 19:17
 **/
@Repository
public interface TmGoodsPriceDao extends BaseDao<TmGoodsPrice,Long> {
    /**
     * 通过商品id获取所有的商品价格 并且按照等级进行排序
     * @param goodsId
     * @return
     */
    @Query(value = "select *  from tm_goods_price where goods_id=:goodsId order by user_level asc" ,nativeQuery = true)
    List<TmGoodsPrice> findAllByGoodsId(@Param("goodsId") Long goodsId);

}
